From: Juergen Gross Date: Mon, 28 Nov 2011 12:23:31 +0000 (+0100) Subject: xl sched-credit: support long options X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/%22bookmarks://%22Dat/%22http:/www.example.com/cgi/%22https:/%22bookmarks:/%22Dat?a=commitdiff_plain;h=25097df0171e7c4312e5c3233ef66bec4677b7f0;p=xen.git xl sched-credit: support long options The help text of xl sched-credit supported long options. Neither the man page nor the implementation did. Signed-off-by: juergen.gross@ts.fujitsu.com Acked-by: Ian Jackson Committed-by: Ian Jackson --- diff --git a/docs/man/xl.pod.1 b/docs/man/xl.pod.1 index eb85ca01fa..ffcb72993a 100644 --- a/docs/man/xl.pod.1 +++ b/docs/man/xl.pod.1 @@ -639,25 +639,30 @@ default B is used for scheduling. =over 4 -=item B [ B<-d> I [ B<-w>[B<=>I] | B<-c>[B<=>I] ] ] +=item B [I] -Set credit scheduler parameters. The credit scheduler is a +Set or get credit scheduler parameters. The credit scheduler is a proportional fair share CPU scheduler built from the ground up to be work conserving on SMP hosts. Each domain (including Domain0) is assigned a weight and a cap. -B +B =over 4 -=item I +=item B<-d DOMAIN>, B<--domain=DOMAIN> + +Specify domain for which scheduler parameters are to be modified or retrieved. +Mandatory for modifying scheduler parameters. + +=item B<-w WEIGHT>, B<--weight=WEIGHT> A domain with a weight of 512 will get twice as much CPU as a domain with a weight of 256 on a contended host. Legal weights range from 1 to 65535 and the default is 256. -=item I +=item B<-c CAP>, B<--cap=CAP> The cap optionally fixes the maximum amount of CPU a domain will be able to consume, even if the host system has idle CPU cycles. The cap diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 97141d192d..40c669aa09 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -3804,8 +3804,19 @@ int main_sched_credit(int argc, char **argv) const char *dom = NULL; int weight = 256, cap = 0, opt_w = 0, opt_c = 0; int opt, rc; + int option_index = 0; + static struct option long_options[] = { + {"domain", 1, 0, 'd'}, + {"weight", 1, 0, 'w'}, + {"cap", 1, 0, 'c'}, + {"help", 0, 0, 'h'}, + {0, 0, 0, 0} + }; - while ((opt = def_getopt(argc, argv, "d:w:c:", "sched-credit", 0)) != -1) { + while (1) { + opt = getopt_long(argc, argv, "d:w:c:h", long_options, &option_index); + if (opt == -1) + break; switch (opt) { case 0: case 2: return opt; @@ -3820,6 +3831,9 @@ int main_sched_credit(int argc, char **argv) cap = strtol(optarg, NULL, 10); opt_c = 1; break; + case 'h': + help("sched-credit"); + return 0; } }